<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('tgmc客户产品基础信息设置')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>产品名称：</label>
                                <input type="text" name="partName"/>
                            </li>
                            <li>
                                <label>产品编码：</label>
                                <input type="text" name="partCode"/>
                            </li>
                            <li>
                                <label>客户名称：</label>
                                <select name="customerName" th:with="si=${cuslist}">
                                    <option value="">所有</option>
                                    <option th:each="cus : ${si}" th:text="${cus.customerName}" th:value="${cus.customerName}"></option>
                                </select>
                            </li>
                            <li>
                                <label>使用状态：</label>
                                <select name="useStatus" th:with="type=${@dict.getType('use_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="commondata:tgmcusprolist:add">
                    <i class="fa fa-plus"></i> 批量添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="commondata:tgmcusprolist:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="commondata:tgmcusprolist:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="commondata:tgmcusprolist:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('commondata:tgmcusprolist:edit')}]];
        var removeFlag = [[${@permission.hasPermi('commondata:tgmcusprolist:remove')}]];
        var useStatusDatas = [[${@dict.getType('use_status')}]];
        var prefix = ctx + "commondata/tgmcusprolist";
        var columnArrays = [
                {
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '编号',
                    visible: false
                },
                {
                    field: 'partType',
                    title: '产品类型'
                },
                {
                    field: 'partName',
                    title: '产品名称'
                },
                {
                    field: 'partCode',
                    title: '产品编码'
                },
                {
                    field: 'customerCode',
                    title: '客户编码'
                },
                {
                    field: 'customerName',
                    title: '客户简称'
                },
                {
                    field: 'customerFullName',
                    title: '客户全称'
                },
                {
                    field: 'useStatus',
                    title: '使用状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(useStatusDatas, value);
                    }
                },
        ];
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "产品基础信息",
            columns: columnArrays
        };

        $(function() {
            $.table.init(options);
        });
    </script>
</body>
</html>